﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Coroutine_基本原理 : MonoBehaviour
{
    private IEnumerator enumerator;
    // Start is called before the first frame update
    private void Start()
    {
        enumerator = CoroutineFun();
    }

    private void OnGUI()
    {
        if (GUILayout.Button("MoveNext"))
        {
            print(enumerator.MoveNext());
            print(enumerator.Current);
        }
    }

    private IEnumerator CoroutineFun() //和update协同
    {
        print("A");
        yield return 1;
        print("B");
        yield return 2;
        print("C");
        yield return 3;
        print("D");
        yield return 4;
    }
}

//接口里面只能定义方法,属性也是方法